using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;

namespace Beetle;

public class LICENSE
{
	private static LICENSE m_a = null;

	private static RSACryptoServiceProvider m_b = new RSACryptoServiceProvider(2048);

	[CompilerGenerated]
	private string c;

	[CompilerGenerated]
	private string d;

	[CompilerGenerated]
	private DateTime e;

	[CompilerGenerated]
	private int f;

	public string Company
	{
		[CompilerGenerated]
		get
		{
			return c;
		}
		[CompilerGenerated]
		set
		{
			c = value;
		}
	}

	public string EMail
	{
		[CompilerGenerated]
		get
		{
			return d;
		}
		[CompilerGenerated]
		set
		{
			d = value;
		}
	}

	public DateTime ValidDate
	{
		[CompilerGenerated]
		get
		{
			return e;
		}
		[CompilerGenerated]
		set
		{
			e = value;
		}
	}

	public int MaxConnections
	{
		[CompilerGenerated]
		get
		{
			return f;
		}
		[CompilerGenerated]
		set
		{
			f = value;
		}
	}

	public override string ToString()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendFormat("Version:{0}\r\n", GetType().Assembly.GetName().Version);
		stringBuilder.AppendFormat("Company:{0}\r\n", Company);
		stringBuilder.AppendFormat("EMail:{0}\r\n", EMail);
		stringBuilder.AppendFormat("ValidDate:{0}\r\n", ValidDate);
		stringBuilder.AppendFormat("MaxConnections:{0}\r\n", MaxConnections);
		return stringBuilder.ToString();
	}

	public static LICENSE GetLICENSE()
	{
		lock (typeof(LICENSE))
		{
			if (LICENSE.m_a == null)
			{
				LICENSE.m_a = new LICENSE();
				try
				{
					LICENSE.m_b.FromXmlString("<RSAKeyValue><Modulus>pkeTDrmB8cQUC7zd/CStdr02vmgn1TscKGVDLuDTeJ1I3zkzQmlYAy/FvROUTIfvJnf/sNrEsl86o50XaTUXQy6kPm5Kmaoi3A24EajELKhq7+lOjjF7jC7WA5DwIOjTb4wZ/3rzaouVbdyUYEM6XRTFUVxeIKgplzpVVYPjv4uD3P5y9XVKtT3ltcpNPVk+AJjKwasZRQ4a/r3It9Fl4isKi122VWWpZd3tCa+Q8usX1VvDZYuREeql5iek21ca8aaLT1zxZq/j/6V+vyUxQH3GIfaAI8NipG09nu9EU6CHqjlQuCWBfH865CbrjMiRmM5KByAsC5JazDNSMrRo5Q==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
					string path = TcpUtils.h() + "license.sn";
					using StreamReader streamReader = new StreamReader(path);
					string[] array = streamReader.ReadToEnd().Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
					if (a(array[0], array[1]))
					{
						string[] array2 = Encoding.UTF8.GetString(Convert.FromBase64String(array[0])).Split(';');
						LICENSE.m_a.Company = array2[0];
						LICENSE.m_a.EMail = array2[1];
						LICENSE.m_a.MaxConnections = int.Parse(array2[2]);
						LICENSE.m_a.ValidDate = new DateTime(long.Parse(array2[3]));
					}
				}
				catch (Exception ex)
				{
					_ = ex.Message;
				}
			}
		}
		return LICENSE.m_a;
	}

	internal static string b(string A_0)
	{
		return Convert.ToBase64String(b(Encoding.UTF8.GetBytes(A_0)));
	}

	internal static bool a(string A_0, string A_1)
	{
		return a(Encoding.UTF8.GetBytes(A_0), Convert.FromBase64String(A_1));
	}

	internal static bool a(byte[] A_0, byte[] A_1)
	{
		return LICENSE.m_b.VerifyData(A_0, "MD5", A_1);
	}

	internal static string a(string A_0)
	{
		return Encoding.UTF8.GetString(a(Convert.FromBase64String(A_0)));
	}

	internal static byte[] b(byte[] A_0)
	{
		return LICENSE.m_b.Encrypt(A_0, fOAEP: false);
	}

	internal static byte[] a(byte[] A_0)
	{
		return LICENSE.m_b.Decrypt(A_0, fOAEP: false);
	}
}
